package bavaria.hightech.banking.junit;

import java.math.BigInteger;
import org.junit.Before;
import org.junit.Test;

import bavaria.hightech.banking.money.Currency;
import bavaria.hightech.banking.money.Money;
import bavaria.hightech.banking.money.Currency.currencyEnum;

/**
 * junit testcase MoneyTest
 * @author David
 *
 */
public class MoneyTest extends junit.framework.TestCase {
	// aufgabe 8 aktualisieren
	private Money money1;
	private Money money2;

	@Override
	@Before
	public void setUp() throws Exception {
		money1 = new Money(Currency.currencyEnum.EURO);
		money2 = new Money(Currency.currencyEnum.EURO);
		money1.addAmount(currencyEnum.EURO, new BigInteger("50"));
		money2.addAmount(currencyEnum.DOLLAR, new BigInteger("50"));
	}

	@Test
	public void testAdd() {
		money1.addAmount(currencyEnum.EURO, new BigInteger("50"));
		assertTrue(money1.getBalance() == 100);
	}

	@Test
	public void testDraw() {
		money2.drawAmount(currencyEnum.EURO, new BigInteger("50"));
		assertTrue(money2.getBalance() == 0);
		assertFalse(money2.getBalance() == 10);
	}

	@Test
	public void testEquals() {
		money1.addAmount(currencyEnum.EURO, new BigInteger("10"));
		assertTrue(money1.isEqualTo(new BigInteger("60")));
	}

	@Test
	public void testIsGreaterThan() {
		assertTrue(money2.isGreaterThan(new BigInteger("5")));
	}

}
